package com.spider.silence.main;

import com.spider.silence.downloader.AiKaForumDownLoader;
import com.spider.silence.env.job.*;
import com.spider.silence.job.*;
import com.spider.silence.pool.AiKaDownLoaderPool;
import com.spider.silence.utils.PropertiesUtil;
import com.spider.silence.utils.QuartzManager;

import org.apache.log4j.PropertyConfigurator;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by 夏茂轩 on 2016/12/15.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        PropertyConfigurator.configure(PropertiesUtil.getLogPro());//初始化日志环境
        ExecutorService initPool = Executors.newFixedThreadPool(Integer.parseInt(PropertiesUtil.getVal("main.env.runnable.pool.size")));
        /*initPool.execute(new ZuiChengduEnvInitJob());//初始化最成都环境
        initPool.execute(new QZoneEnvInitJob());//初始化QQ空间环境
        initPool.execute(new TianFuForumEnvInitJob());//初始化天府社区环境
        initPool.execute(new MaLaEnvInitJob());//初始化麻辣论坛环境
        initPool.execute(new TianYaEnvInitJob());//初始化天涯论坛环境
        initPool.execute(new JianYangEnvInitJob());//初始化简阳论坛环境
        initPool.execute(new ChengDuLifeEnvInitJob());//初始化程度生活网论坛环境
        initPool.execute(new KaiDiEnvInitJob());//初始化凯迪社区环境
        initPool.execute(new TencentWeiBoInitJob());//初始化腾讯微博环境
        initPool.execute(new AiKaInitJob());//初始化爱卡爬虫环境
        initPool.execute(new SinaWeiBoInitJob());//初始化新浪微博爬虫环境
        initPool.execute(new XiQinHuiGuanEnvlnitJob());//初始化西秦会馆自贡论坛
        initPool.execute(new WyzxInitJob());//初始化乌有之乡爬虫环境
        initPool.execute(new Njd1InitJob());//初始化内江第一城的环境
        initPool.execute(new SinaNewsEnvInitJob());//初始化新浪新闻环境
        initPool.execute(new YiBinZeroJuLiInitJob());//初始宜宾零距离环境*/

        initPool.execute(new SinaSiChuanEnvInitJob());//初始新浪四川环境
        initPool.execute(new ChinaNewsForSiChuanEnvInitJob());//初始中国新闻网四川频道环境
        initPool.execute(new CRIOnlineForSiChuanEnvInitJob());//初始国际在线四川频道环境
        initPool.execute(new ChengDuWanBaoEnvInitJob());//初始成都晚报环境
        initPool.execute(new InformantCenterForSiChuanEnvInitJob());//初始四川互联网举报中心环境
        initPool.execute(new SiChuanRenShiEnvInitJob());//初始四川人事环境
        //initPool.execute(new BaiduForumInitJob());//初始化百度贴吧环境


        //启动定时任务，定时添加特定任务到任务管理器
        /*QuartzManager.addJob("QZone", QZoneJob.class, PropertiesUtil.getVal("QZone.task.generate.schedule"));
        QuartzManager.addJob("ZuiChengdu", ZuiChengDuJob.class, PropertiesUtil.getVal("ZuiChengDu.task.generate.schedule"));
        QuartzManager.addJob("TianFuForum", TianFuForumJob.class, PropertiesUtil.getVal("TianFuForum.task.generate.schedule"));
        QuartzManager.addJob("MaLa", MaLaJob.class, PropertiesUtil.getVal("MaLa.task.generate.schedule"));
        QuartzManager.addJob("TianYa", TianYaJob.class, PropertiesUtil.getVal("TianYa.task.generate.schedule"));
        QuartzManager.addJob("JianYang", JianYangJob.class, PropertiesUtil.getVal("JianYang.task.generate.schedule"));
        QuartzManager.addJob("ChengDuLife", ChengDuLifeJob.class, PropertiesUtil.getVal("ChengduLife.task.generate.schedule"));
        QuartzManager.addJob("KaiDi", KaiDiJob.class, PropertiesUtil.getVal("KaiDi.task.generate.schedule"));
        QuartzManager.addJob("TencentWeiBo", TencentWeiBoJob.class, PropertiesUtil.getVal("TencentWeiBo.task.generate.schedule"));
        QuartzManager.addJob("AiKa", AiKaJob.class, PropertiesUtil.getVal("AiKa.task.generate.schedule"));
        QuartzManager.addJob("SinaWeiBo", SinaWeiBoJob.class, PropertiesUtil.getVal("Sina.task.generate.schedule"));
        QuartzManager.addJob("SinaWeiBoDownLoaderJob", SinaWeiBoDownloaderJob.class, PropertiesUtil.getVal("Sina.downloader.generate.schedule"));
        QuartzManager.addJob("XiQinHuiGuan", XiQinHuiGuanJob.class, PropertiesUtil.getVal("XiQinHuiGuan.task.generate.schedule"));
        QuartzManager.addJob("Wyzx", WyzxJob.class, PropertiesUtil.getVal("Wyzx.downloader.generate.schedule"));
        QuartzManager.addJob("Njd1", Njd1Job.class, PropertiesUtil.getVal("Njd1.downloader.generate.schedule"));
        QuartzManager.addJob("SinaNewsDownLoaderJob", SinaNewsJob.class, PropertiesUtil.getVal("SinaNews.downloader.generate.schedule"));
        QuartzManager.addJob("YiBinZeroJuLiJob", YiBinZeroJuLiJob.class, PropertiesUtil.getVal("YiBinZeroJuLi.downloader.generate.schedule"));*/

        //QuartzManager.addJob("BaiduForum", BaiduForumJob.class, PropertiesUtil.getVal("BaiduForum.task.generate.schedule"));
        QuartzManager.addJob("SinaSiChuan", SinaSiChuanJob.class, PropertiesUtil.getVal("SinaSiChuan.task.generate.schedule"));
        QuartzManager.addJob("ChinaNewsForSiChuan", ChinaNewsForSiChuanJob.class, PropertiesUtil.getVal("ChinaNewsForSiChuan.task.generate.schedule"));
        QuartzManager.addJob("CRIOnlineForSiChuan", CRIOnlineForSiChuanJob.class, PropertiesUtil.getVal("CRIOnlineForSiChuan.task.generate.schedule"));
        QuartzManager.addJob("ChengDuWanBao", ChengDuWanBaoJob.class, PropertiesUtil.getVal("ChengDuWanBao.task.generate.schedule"));
        QuartzManager.addJob("InformantCenterForSiChuan", InformantCenterForSiChuanJob.class, PropertiesUtil.getVal("InformantCenterForSiChuan.task.generate.schedule"));
        QuartzManager.addJob("SiChuanRenShi", SiChuanRenShiJob.class, PropertiesUtil.getVal("SiChuanRenShi.task.generate.schedule"));
        initPool.shutdown();
    }

}
